<template>
	<view class="archives">
		<view class="archives_info" @click="goToInfoData">
			<view class="info_fl">
				<text>{{userInfo.name}}</text>
				<text style="color: #909090;"> {{userInfo.sex | sexType}} | {{userInfo.age || 0}}岁</text> 
			</view>
			<view class="info_fr">
				基础资料 
				<image class="info_fr_arr" :src="require('../status/image/arr.png')" mode=""></image>
			</view>
		</view>
		<view class="archives_deta">
			 <view class="data_top">
				 <text>我们会采取专业措施保障用户隐私安全</text><br>
				 <text>完成度越高的健康档案,有可能获得专业医师的评估和建议。</text>
			 </view>
			 <view class="data_con">
				<view class="data_con_fl" @click="goToAddArcguves">
					<text>身高体重</text>  
					<view class="con_fl_info">
						<text v-if="userInfo.height" style="margin-right: 10rpx;">{{userInfo.height}}kg</text>
						<text v-if="userInfo.wight">{{userInfo.wight}}cm</text>
					</view> 
				</view>
				<view class="data_con_fr">
					<text>血尿酸</text>
					<text v-if="userInfo.ua">{{userInfo.ua}}umol/L</text>
				</view>
			 </view>
		</view>
		<view class="archives_jc" @click="goToInspect">
			<image class="recommend" :src="require('../status/image/recommend.png')" mode=""></image>
			<view class="jc_fl">
				<image class="jc_fl_img" :src="require('../status/image/tingzhen.png')" mode=""></image>
				<text>检查单</text>
			</view>
			<view class="jc_fr">
				<text v-if="userInfo.number">{{userInfo.number || 0}}张</text>
				<image class="info_fr_arr" :src="require('../status/image/arr.png')" mode=""></image>
			</view>
		</view>
		<!-- <view class="archives_foo">
			<view class="foo_top">保存检查单，帮助医生做出更准确的判断</view>
			<view class="foo_nav">
				 <view class="foo_item">
					 <image src='../../status/image/timg.png' mode=""></image>
					 <text>肾功能</text>
				 </view>
				 <view class="foo_item">
				 					 <image src='../../status/image/timg.png' mode=""></image>
				 					 <text>肾功能</text>
				 </view>
				 <view class="foo_item">
				 					 <image src='../../status/image/timg.png' mode=""></image>
				 					 <text>肾功能</text>
				 </view>
			</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				returnPage: null,
				userInfo:'',
			};
		},
		onShow() {
			this.getHealthInfo()
		},
		methods:{
			goToInspect(){
				uni.navigateTo({
					url: 'inspect/index'
				})
			},
			goToInfoData(){
				this.$api.sendRequest({
					url: '/api/health/detail',
					success: res => { 
						uni.navigateTo({
							url: 'infodata/index?healthDetail=' + JSON.stringify(res)
						})
					}
				})
			 
			},
			// 获取健康信息
			getHealthInfo(){
				let that = this
				that.$api.sendRequest({
					url: '/api/health/index',
					success: res => {
						if(res.code >= 0){ 
							this.userInfo = res.data
						}else{
							uni.showToast({
								title: res.code,
								icon: 'none',
								success: () => {
								clearTimeout(that.returnPage)
								that.returnPage = setTimeout(() => {
										uni.navigateTo({
											url: './infodata/index'
										})
									},1000)
								}
							})
						} 
					}
				})
			},
			
			goToAddArcguves(){
				uni.navigateTo({
					url: 'addarcguves/index'
				})
			}
		},
		filters:{
			sexType(num) {
				return num == 1? '男' : '女'
			}
		}
	}
</script>

<style lang="less">
.archives{
	.archives_info{
		padding: 20rpx;
		display: flex;
		justify-content: space-between;
		// height: 100rpx;  
		background-color: #fff;
		.info_fl{
			display: flex;
			flex-direction: column;
		}
		.info_fr{
			line-height: 100rpx;
			color: #909090;
			.info_fr_arr{
				margin-left: 10rpx;
				width: 32rpx;
				height: 32rpx;
				vertical-align: middle;
			}
		}
	}
	.archives_deta{
		padding: 20rpx;
		margin-top: 10rpx; 
		background-color: #fff;
		.data_top{
			height: 160rpx;
			color: #909090;
			border-bottom: 6rpx solid #fcfcfc;
		}
		.data_con{
			display: flex;
			height: 200rpx;
			view {
				padding-top: 20rpx;
				flex: 1;
				font-size: 32rpx;
				& text:last-child{
					display: block;
					margin-top: 20rpx;
					color: #737373;
					font-size: 30rpx;
				}
			}
			.data_con_fl{
				.con_fl_info{
					min-width: 200rpx;
					height: 100rpx;
					line-height: 20rpx;
					text {
						display: inline-block;
						color: #333;
					}
				}
			}
		}
	}
	.archives_jc{
		position: relative; 
		margin: 40rpx 0 20rpx 0;
		padding: 0 20rpx 0 60rpx;
		display: flex;
		justify-content: space-between;
		height: 180rpx;  
		background-color: #fff;
		.recommend{
			position: absolute;
			left: 20rpx;
			top: -20rpx;
			width: 40rpx;
			height: 80rpx;
		}
		.jc_fl,
		.jc_fr{
			font-size: 32rpx;
			line-height: 180rpx;
			.info_fr_arr{
				width: 36rpx;
				height: 36rpx;
				vertical-align: middle;
			}
			.jc_fl_img{
				margin-right: 20rpx;
				width: 60rpx;
				height: 60rpx;
				vertical-align: middle;
			}
		} 
	}
	.archives_foo{
		padding: 0 20rpx;
		// height: 400rpx;
		background-color: #fff;
		.foo_top{
			height: 90rpx;
			line-height: 90rpx;
			color: #818181;
			border-bottom: 2rpx solid #f9f9f9;
		}
		.foo_nav{
			padding: 10rpx 0;
			display: flex;
			.foo_item{
				flex: 1;
				display: flex;
				text-align: center;
				flex-direction: column;
				image{ 
					margin: 0 auto 20rpx auto;
					width: 80rpx;
					height: 100rpx;
				}
			}
		}
	}
}
</style>
7